package org.apix.commands.command;

import org.apix.Apix;
import org.apix.commands.BaseCommand;
import org.apix.configuration.PlayerStorageData;
import org.bukkit.entity.Player;

public class Warp extends BaseCommand {

	public boolean execute(Player p, org.bukkit.command.Command command, String[] args){
		if(!isEnabled()) {
			return false;
		}
		
		if(!this.defaultCommandChecks(p)) {
			return true;
		}
		
		if(args.length > 0) {
			Apix.log.info("Attempting to send player "+ p.getName() +" to warp.");
			p.teleport(PlayerStorageData.getInstance(p).getWarp(args[0]));
		}
		else {
			p.sendMessage("Usage:");
			p.sendMessage("  /warp <warpname>: go to your warp on current world");
		}
		
		return true;
	}
}
